package com.example.crm.service.Impl;

import com.example.crm.dao.IAdminDAO;
import com.example.crm.dao.Impl.AdminDAOImpl;
import com.example.crm.pojo.Admin;
import com.example.crm.service.IAdminService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.sql.SQLException;
@Data
@Component(value = "adminService")
public class AdminServiceImpl implements IAdminService {

//    IAdminDAO adminDAO = new AdminDAOImpl();

    // 依赖注入

    @Autowired
        IAdminDAO adminDAO;
    @Override
    public Admin login(String username, String password) {
        Admin admin = null;
        try {
            admin = adminDAO.find(username,password);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return admin;
    }
}
